from locust import HttpLocust, TaskSet, task

class WebsiteTasks(TaskSet):

    # def on_start(self):
    #     self.client.get("/user/")

    @task(3)
    def user_index(self):
        self.client.get("/user/")
    # @task
    # def school(self):
    #     self.client.get("/school/")

    # @task
    # def check_bind_user(self):
    #     self.client.post("/user/check_bind_user", {
    #         "ksh": "17410101110003",
    #         "sfzh": "410111199809090003"
    #     # })


    # @task
    # def tk_index(self):
    #     self.client.get("/send_verify/")
    # @task
    # def school_index(self):
    #     self.client.get("/user/")

    def on_start(self):
        self.client.post("/user/check_login", {
            "username": "18511995224",
            "password": "aaaaaa"
        })

    @task(1)
    def check_login(self):
        self.client.post("/user/check_login", {
            "username": "18511995224",
            "password": "aaaaaa"
        })

    @task(2)
    def index(self):
        self.client.get("/school/school_list")

    @task(2)
    def about(self):
        self.client.get("/tk/tk_major_list")

    @task(1)
    def user_center(self):
        self.client.get("/user/user_center")

    @task(3)
    def school_info(self):
        self.client.get("/school/school_info?id=119")



class WebsiteUser(HttpLocust):
    task_set = WebsiteTasks
    # min_wait = 2000
    # max_wait = 5000
